﻿using AspDotNet.Core6.Mvc.ViewComponents.Models;

namespace AspDotNet.Core6.Mvc.ViewComponents.Services
{
    public interface IShoppingService
    {
        IEnumerable<Prodcut> GetProdcuts();
    }

    public class ShoppingService : IShoppingService
    {
        public IEnumerable<Prodcut> GetProdcuts()
        {
            return Enumerable.Range(0, 20)
                .Select((p, index) =>
                new Prodcut()
                {
                    Id = index + 1,
                    Name = "Product" + (index + 1),
                    Price = index + 1,
                    Quantity = ((index + 1) * 10).ToString()
                });
        }
    }
}
